const { application: devBucket } = require("../ciri_config/.ciri-upload.dev.config.js");
const { application: debugBucket } = require("../ciri_config/.ciri-upload.test.config.js");
const { application: prodBucket } = require("../ciri_config/.ciri-upload.prod.config.js");

const prodEnv = {
  api: "",
  cdnBucket: prodBucket,
  get cdnBucketPath() {
    return `https://biv.oss-cn-hangzhou.aliyuncs.com/${this.cdnBucket}/dist/`;
  }
};

const devEnv = {
  api: "http://39.101.203.154:30004",
  cdnBucket: devBucket,
  get cdnBucketPath() {
    return `https://biv.oss-cn-hangzhou.aliyuncs.com/${this.cdnBucket}/dist/`;
  }
};
const testEnv = {
  api: "https://test-open-gateway.enbrands.com",
  cdnBucket: debugBucket, // 公用测试bucket
  get cdnBucketPath() {
    return `https://biv.oss-cn-hangzhou.aliyuncs.com/${this.cdnBucket}/dist/`;
  }
};

module.exports = ((env) => {
  let config;
  switch (env) {
    case "development": {
      config = devEnv;
      break;
    }
    case "test": {
      config = testEnv;
      break;
    }
    case "production": {
      config = prodEnv;
      break;
    }
    default: {
      config = testEnv;
      break;
    }
  }
  return config;
})(process.env.VUE_APP_ENV);
